using System;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.SupplyChain.Material;

/// <summary>
/// 系统计量单位实体类
/// 用于管理和维护系统中的各种计量单位信息，如重量、长度、体积等
/// </summary>
public class SysMeasureUnit : TreePoco<SysMeasureUnit>
{
    /// <summary>
    /// 计量单位名称
    /// </summary>
    [Display(Name = "名称", Description = "计量单位的名称，如千克、米、升等")]
    [Required]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Name { get; set; }

    /// <summary>
    /// 计量单位编码
    /// </summary>
    [Display(Name = "编码", Description = "计量单位的唯一编码标识")]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Code { get; set; }

    /// <summary>
    /// 计量单位分组
    /// </summary>
    [Display(Name = "分类", Description = "计量单位所属的分组分类")]
    public SysMeasureUnitGroup MeasureUnitGroup { get; set; }

    /// <summary>
    /// 计量单位分组ID
    /// </summary>
    [Display(Name = "分类ID", Description = "计量单位分组的唯一标识符")]
    public Guid? MeasureUnitGroupId { get; set; }

    /// <summary>
    /// ERP系统ID
    /// 与外部ERP系统同步时使用的标识符
    /// </summary>
    [Display(Name = "ErpId", Description = "与外部ERP系统同步时使用的标识符")]
    [StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
    public string ErpId { get; set; }

    /// <summary>
    /// 详细描述
    /// </summary>
    [Display(Name = "详情", Description = "计量单位的详细说明和备注信息")]
    [StringLength(1024, ErrorMessage = "{0}长度不能超过{1}")]
    public string Description { get; set; }
    
    /// <summary>
    /// 计量单位状态
    /// </summary>
    [Display(Name = "状态", Description = "计量单位的当前状态，如启用、禁用等")]
    public CommonState State { get; set; }
    
    /// <summary>
    /// 层级
    /// </summary>
    [Display(Name = "层级")]
    public int Level { get; set; }
    
    /// <summary>
    /// 创建时间
    /// 记录该计量单位组的创建时间
    /// </summary>
    [Display(Name = "创建时间", Description = "记录该计量单位组的创建时间")]
    public DateTime? CreateTime { get; set; }
    
    /// <summary>
    /// 最后更新时间
    /// 记录该计量单位组的最后一次修改时间
    /// </summary>
    [Display(Name = "最后更新时间", Description = "记录该计量单位组的最后一次修改时间")]
    public DateTime? UpdateTime { get; set; }
    
    /// <summary>
    /// 创建人
    /// </summary>
    [StringLength(64)]
    [Display(Name = "创建人")]
    public string CreateBy { get; set; }
    
    /// <summary>
    /// 更新人
    /// </summary>
    [StringLength(64)]
    [Display(Name = "更新人")]
    public string UpdateBy { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [Display(Name = "备注", Description = "计量单位组的备注信息")]
    [StringLength(256)]
    public string Remark { get; set; }
}

public class SysMeasureUnitView : SysMeasureUnit
{
    public string ParentName { get; set; }
    
    public string GroupName { get; set; }
}